/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package xmlconvert.internalStructure;

/**
 *
 * @author ash
 */
public class Verifications {
    
    
    public static void verifyField(String name, String value) throws VerificationException{
        verifyFieldName(name);
        verifyFieldValue(value);
    }
    
    
    private static void verifyFieldName(String name) throws VerificationException{
        if (name.isEmpty()){
            throw new VerificationException("Name of the field cannot be blank (empty string)");
        } else if (name == null){
            throw new VerificationException("Name of the field cannot be null");
        } 
    }
    
    
    private static void verifyFieldValue(String value) throws VerificationException{
        if (value == null){
            throw new VerificationException("Value of the field cannot be null");
        }
    }
     
    
    public static void verifyRecord(String name) throws VerificationException{
        if (name.isEmpty()){
            throw new VerificationException("Record cannot have empty name.");
        } else if (name == null){
            throw new VerificationException("Name of the record cannot be null.");
        }
    }
    
    public static void verifyGroup(String name) throws VerificationException{
        if (name.isEmpty()){
            throw new VerificationException("Group cannot have empty name.");
        } else if (name == null){
            throw new VerificationException("Name of the group cannot be null.");
        }
    }
    
}
